import React from 'react';
import { Breadcrumb, Icon, Button, Table, Modal, Input, Select, Pagination, message ,Row,Col,DatePicker,Form,Checkbox,AutoComplete,InputNumber,Upload } from 'antd';
import $ from 'jquery';
import Config from '../../common/config';
import convertCurrency from '../commonFunction/convertCurrency';
import getFormatDate from '../commonFunction/getFormatData';
import noRepeat from '../commonFunction/noRepeat';
import {browserHistory} from 'react-router';
import moment from 'moment';
const config = new Config();
const { RangePicker } = DatePicker;
const { TextArea } = Input;
const FormItem = Form.Item;
const Option = Select.Option;
const userInfo = JSON.parse(sessionStorage.getItem('UserInfo')); //用户信息
const root = userInfo.root;

class ChannelListBeforeApprove1 extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            visible: false,//我的申请模态框
            dateStr:['',''],//默认今天的日期字符串
            date:['',''],//默认今天的日期
            selectedProduct:'',//筛选产品
            selectedUmbrellaName:'',//筛选平台
            channelname:'',//账户名
            applyPeopleName:'',//筛选申请人姓名
            channelList: [],//申请列表
            channelcount: 0,//申请列表条数
            pageindex:1,//当前页码
            record:{},//单条记录信息
            allSpentMoney:0,//总消费金额
            allInputLines:1,//总进线
            allOutput:1,//总产值
            lastTImeMoney:0,//上次充值金额
            inputAllMoney:0,//充值总额
            allCharge:0,//总成单金额
            againBoughtMoney:0,//其中复购总值
            moneyLeft:0,//余额
            selectionList:[[],[],[],[]],//筛选列表
            authTreeOfOne:{},//小工具权限
        }
    }
    componentWillMount(){
        console.log(userInfo.auth);
        if(userInfo.auth){
            if(userInfo.auth['橘色小工具']){
                this.setState({
                    authTreeOfOne:userInfo.auth['橘色小工具']
                },()=>{
                    console.log(this.state.authTreeOfOne['/payrequest/updatemoney']);
                })
            }
        }
    }
    componentDidMount() {
        //筛选列表
        let selectionList=[[],[],[],[]];
        $.ajax({
            url: `${config.juseLittleTool}/channel/findsource`,
            type: "post",
            async: true,
            headers: {
                'Authorization': 'Bearer ' + sessionStorage.getItem('token'),
            },
            //data:{user:sessionStorage.getItem('token'),},
            success: data => {
                console.log(data);
                if (data.code === 200) {
                    const List = data.data;
                    if (List.length > 0) {
                        List.forEach((ele, i) => {
                            if(ele.product){
                                selectionList[0].push(ele.product);  //产品
                            }
                            if(ele.umbrellaname){
                                selectionList[1].push(ele.umbrellaname);//平台
                            }
                            if(ele.channelname){
                                selectionList[2].push(ele.channelname);//账户名
                            }
                            if(ele.personincharge){
                                selectionList[3].push(ele.personincharge);//负责人
                            }
                        });
                        this.setState({
                            selectionList:[noRepeat(selectionList[0]),noRepeat(selectionList[1]),noRepeat(selectionList[2]),noRepeat(selectionList[3]),]
                        },()=>{
                            console.log(this.state.selectionList);
                        })
                    }

                }
            }
        });
        //时间初始化
        let dateStr=getFormatDate(new Date());
        this.setState({
            dateStr:[dateStr,dateStr],
            date:[moment(dateStr),moment(dateStr)],
        });
        this.getBannerList(1,dateStr,dateStr,);
    }
    //生日禁用
    disabledDate(val) {
        if (val) {
            return val.valueOf() > Date.now();
        } else {
            return false;
        }
    }
    //banner详细信息对话框（新增/编辑）
    showBannerModal(values) {
        //state  1:查看   2:编辑  3:退款
        if(values){
            this.props.form.setFieldsValue({
                product :values.product,//产品
                umbrellaname : values.umbrellaname,//平台
                channelname : values.channelname,//账户名称
                phone : values.phone,//联系电话
                aboutname : values.aboutname,//平台联系人
                company : values.company,//公司名称
                personincharge : values.personincharge,//责任人
                yesterdayrecharge:values.yesterdayrecharge,//上次充值金额
                rechargesum:values.rechargesum,//充值总额
                consumptionmoney:values.consumptionmoney,//消费金额
                coillnsum:values.coillnsum,//总进线
                coiloutsum:values.coiloutsum,//总推线
                communication:values.communication,//总沟通数
                ordersum:values.ordersum,//总成单数
                issueratio:values.issueratio,//平台出单率
                ordersummoney:values.ordersummoney,//总成单金额
                totalvalueofoutput:values.totalvalueofoutput,//总产值
                recyclesum:values.recyclesum,//复购总值
                balance:values.balance,//余额
                refundmoney:values.refundmoney,//退款
                averagelinecost:values.averagelinecost==='NaN'?0:values.averagelinecost,
                outputratio:values.outputratio==='NaN'?0:values.outputratio,//产出比
            });
            this.setState({
                allSpentMoney:values.consumptionmoney?values.consumptionmoney:0,//总消费金额
                allInputLines:values.coillnsum?values.coillnsum:1,//总进线
                allOutput:values.totalvalueofoutput?values.totalvalueofoutput:1,//总产值
                lastTImeMoney:values.yesterdayrecharge?values.yesterdayrecharge:0,//上次充值金额
                inputAllMoney:values.rechargesum?values.rechargesum:0,//充值总额
                allCharge:values.ordersummoney?values.ordersummoney:0,//总成单金额
                againBoughtMoney:values.recyclesum?values.recyclesum:0,//其中复购总值
                moneyLeft:values.balance?values.balance:0,//余额
            });
            this.setState({
                visible: true,
                BannerId: values.id,
                record:values
            });
        }else{
            this.setState({
                visible: true,
                BannerId:undefined,
                record:{}
            });
        }
    }



    //发送通过或驳回请求
    acturalSendRequest(state,msg){
        let url1 = `${config.juseLittleTool}/channel/refundupdate`;
        let data={
            user:sessionStorage.getItem('token'),
            state:state,
            id:this.state.record.id,
        };
        if(state==2){
           data.refundmoney=0;
        }
        $.ajax({
            url: url1,
            type: "post",
            async: true,
            headers: {
                'Authorization': 'Bearer ' + sessionStorage.getItem('token'),
            },
            data,
            success: res => {
                console.log(res);
                if(res.code === 200){
                    this.setState({
                        visible: false,
                    },()=>{
                        message.info(msg,2);
                        const { pageindex,dateStr, selectedProduct,selectedUmbrellaName,channelname,applyPeopleName}=this.state;
                        this.getBannerList(pageindex,dateStr[0],dateStr[1],selectedProduct,selectedUmbrellaName,channelname,applyPeopleName);
                    });
                }else{
                    Modal.warning({
                        title: '操作失败',
                        content: `${res.mes}请返回重新操作`,
                    });
                }
            }
        });
    }
    //驳回
    handleCancel() {
        this.acturalSendRequest('2','驳回成功!');
    }
    //通过
    saveBanner() {
        this.acturalSendRequest('4','通过成功!')
    }


    //获取申请列表  starttime, endtime, product（产品）, umbrellaname（平台）, state, people（申请人）, pagesize, pageindex
    getBannerList(pageindex,starttime, endtime,product,umbrellaname,channelname,people) {
        $.ajax({
        url: `${config.juseLittleTool}/channel/findlist`,
        type: "post",
        async: true,
        headers: {
            'Authorization': 'Bearer ' + sessionStorage.getItem('token'),
         },
        data:{
            //user:sessionStorage.getItem('token'),
            pagesize:15,
            pageindex,
            starttime,
            endtime,
            state:'3',//申请状态
            product,//产品
            umbrellaname,//平台
            channelname,//账户名
            people,//申请人
        },
        success: data => {
            console.log(data);
            if (data.code === 200) {
                const channelList = data.data.rows;
                if (channelList.length > 0) {
                    channelList.forEach((ele, i) => {
                        ele.index = i + 1;
                    });
                    this.setState({
                        channelList,
                        channelcount: data.data.count,
                    });
                }else{
                    this.setState({
                        channelList:[],
                        channelcount: 0,
                    });
                }
            } else {
                message.error(`${data.mes} 请返回重新操作`, 2);
            }
        }
    });
    }
    //分页
    changePage(pageindex) {
        this.setState({
            pageindex
        });
        const { dateStr, selectedProduct,selectedUmbrellaName,channelname,applyPeopleName}=this.state;
        this.getBannerList(pageindex,dateStr[0],dateStr[1],selectedProduct,selectedUmbrellaName,channelname,applyPeopleName);
    }
    //筛选方法
    handleApplyState(state,value){
        console.log(state);
        this.setState({
            pageindex:1,
        })
        const { dateStr,  selectedProduct,selectedUmbrellaName,channelname,applyPeopleName}=this.state;
        if(state===1){
            this.setState({
                selectedProduct:value,
            })
            this.getBannerList(1,dateStr[0],dateStr[1],value,selectedUmbrellaName,channelname,applyPeopleName);
        }else if(state===2){
            this.setState({
                selectedUmbrellaName:value,
            })
            this.getBannerList(1,dateStr[0],dateStr[1],selectedProduct,value,channelname,applyPeopleName);
        }else if(state===3){
            this.setState({
                channelname:value,
            })
            this.getBannerList(1,dateStr[0],dateStr[1],selectedProduct,selectedUmbrellaName,value,applyPeopleName);
        }else{
            this.setState({
                applyPeopleName:value,
            })
            this.getBannerList(1,dateStr[0],dateStr[1],selectedProduct,selectedUmbrellaName,channelname,value);
        }
    }
    //日期筛选方法
    changeDate(date, dateStr) {
        this.setState({
            dateStr,
            date,
        });
        this.setState({
            pageindex:1,
        })
        const {  selectedProduct,selectedUmbrellaName,channelname,applyPeopleName}=this.state;
        this.getBannerList(1,dateStr[0],dateStr[1],selectedProduct,selectedUmbrellaName,channelname,applyPeopleName);
    }
    //筛选查询
    doSearch(){
        this.setState({
            pageindex:1,
        })
        const { dateStr,  selectedProduct,selectedUmbrellaName,channelname,applyPeopleName}=this.state;
        this.getBannerList(1,dateStr[0],dateStr[1],selectedProduct,selectedUmbrellaName,channelname,applyPeopleName);
    }
    //刷新
    reloadByHand(){
        this.doSearch();
    }
    render() {
        //费用预览表格
        const data = [
            {
                title: '退费时间',
                dataIndex: 'updatetime',
                width: 170,
            },{
                title: '产品',
                dataIndex: 'product',
                width: 120,
            },{
                title: '平台',
                dataIndex: 'umbrellaname',
                width: 120,
            },{
                title: '账户名',
                dataIndex: 'channelname',
                width: 120,
            },{
                title: '充值总额',
                dataIndex: 'rechargesum',
                width: 100,
            },{
                title: '消费金额',
                width: 100,
                dataIndex: 'consumptionmoney',
            },{
                title: '退回金额',
                width: 100,
                dataIndex: 'refundmoney',
            },
            {
                title: '操作',
                width: 100,
                render: (text, record) => (
                    <div>
                        {record.updatetime==="总计"?'': <div>
                            <Button  type="primary" onClick={this.showBannerModal.bind(this,record,1)}>操作</Button>
                       </div>}
                     </div>
                )
            }
        ];
        const { getFieldDecorator, } =this.props.form;
        const formItemLayout = { labelCol: { span: 10 }, wrapperCol: { span: 14 }, };
        const{allSpentMoney,allInputLines,visible,record,selectionList,authTreeOfOne}=this.state;
        console.log(authTreeOfOne['/channel/refundupdate']);
        console.log(authTreeOfOne);
        return (
            <div className='goods-label clearfix'>
                {/*面包屑*/}
                < Breadcrumb separator=">" >
                    <Breadcrumb.Item>橘色小工具</Breadcrumb.Item>
                    <Breadcrumb.Item>待审中心</Breadcrumb.Item>
                    <Breadcrumb.Item>退费待审</Breadcrumb.Item>
                </Breadcrumb >
                {/*筛选条*/}
                <div style={{marginTop:'40px'}} className="clearfix">
                    <Row>
                        <Col span={5}>
                            时间:&nbsp;&nbsp;&nbsp;
                            <RangePicker placeholder={['请选择日期', '请选择日期']}
                                        onChange={this.changeDate.bind(this)}
                                         format='YYYY-MM-DD'
                                         value={this.state.date}
                                         style={{width:'180px'}}
                                         disabledDate={(val) => this.disabledDate(val)}
                            />
                        </Col>
                        <Col span={4}>
                            产品:&nbsp;&nbsp;&nbsp;
                            <Select  style={{width:'110px'}} onChange={this.handleApplyState.bind(this,1)} defaultValue="">
                                <Option value='' >全部</Option>
                                {selectionList[0].map(item=><Option value={item} key={item}>{item}</Option>)}
                            </Select>
                        </Col>
                        <Col span={4}>
                            平台:&nbsp;&nbsp;&nbsp;
                            <Select  style={{width:'110px'}} onChange={this.handleApplyState.bind(this,2)} defaultValue="">
                                <Option value='' >全部</Option>
                                {selectionList[1].map(item=><Option value={item} key={item}>{item}</Option>)}
                            </Select>
                        </Col>
                        <Col span={4}>
                            账户名:&nbsp;&nbsp;&nbsp;
                            <Select  style={{width:'110px'}} onChange={this.handleApplyState.bind(this,3)} defaultValue="">
                                <Option value='' >全部</Option>
                                {selectionList[2].map(item=><Option value={item} key={item}>{item}</Option>)}
                            </Select>
                        </Col>
                        <Col span={4}>
                            申请人:&nbsp;&nbsp;&nbsp;
                            <Select  style={{width:'110px'}} onChange={this.handleApplyState.bind(this,4)} defaultValue="">
                                <Option value='' >全部</Option>
                                {selectionList[3].map(item=><Option value={item} key={item}>{item}</Option>)}
                            </Select>
                        </Col>
                        <Col span={3}>
                            <Button type="primary" onClick={this.doSearch.bind(this)}>查询</Button>
                            {/*<Button  style={{marginLeft:'10px'}} onClick={this.reloadByHand.bind(this)}>刷新</Button>*/}
                        </Col>
                    </Row>
                    <div ref={(printdiv)=>{this.printdiv = printdiv}} className='allgoods-table clearfix' style={{marginTop:'40px'}}>
                        <Table
                               rowKey="index"
                               columns={data}
                               dataSource={this.state.channelList}
                               pagination={false}
                               bordered
                        />
                    </div>
                </div>
                <Row style={{marginTop:'40px'}} align="bottom">
                    <Col span={10} offset={10}>
                        {
                            this.state.channelcount == 0?
                                <p className="floor-ppagip">
                                    共{this.state.channelcount}条记录
                                </p> :
                                <p className="floor-ppagip">
                                    当前显示
                                    {this.state.channelcount===0?0:(15*(this.state.pageindex-1)+1)}—
                                    {15*this.state.pageindex < this.state.channelcount ? 15*this.state.pageindex : this.state.channelcount}条记录，
                                    共{this.state.channelcount}条记录
                                </p>
                        }
                        <Pagination showQuickJumper  current={this.state.pageindex}  defaultPageSize={15} onChange={this.changePage.bind(this)} total={ this.state.channelcount||1}   />
                    </Col>
                </Row>
                <Modal
                    className="little-tool-modal"
                    title='退费详情操作'
                    visible={visible}
                    footer={null}
                    onCancel={()=>{this.setState({visible:false})}}
                    maskClosable={false}
                >
                    <Form className="form-color">
                        <Row>
                            <Col span={7} >
                                <FormItem {...formItemLayout} label="产品"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('product', {
                                        rules: [{ required: true, message: '请输入产品名称' },
                                            { pattern: /^\S+$/, message: '请不要输入空格'}],
                                    })(
                                        <AutoComplete disabled={true}
                                            // dataSource={this.state.medicalNameDataSource}
                                            // onSearch={this.handleSearch}
                                                      placeholder="请输入产品名称"
                                        />
                                    )}
                                </FormItem>
                            </Col>
                            <Col span={5} >
                                <FormItem {...formItemLayout} label="平台"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('umbrellaname', {
                                        rules: [{ required: true, message: '请输入平台' },
                                            { pattern: /^\S+$/, message: '请不要输入空格'}],
                                    })(
                                        <AutoComplete disabled={true}
                                            // dataSource={this.state.medicalNameDataSource}
                                            // onSearch={this.handleSearch}
                                                      placeholder="请输入平台"
                                        />
                                    )}
                                </FormItem>
                            </Col>
                            <Col span={7} >
                                <FormItem {...formItemLayout} label="账户名"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('channelname', {
                                        rules: [{ required: true, message: '请输入账户名' },
                                            { pattern: /^\S+$/, message: '请不要输入空格'}],
                                    })(
                                        <AutoComplete disabled={true}
                                            // dataSource={this.state.medicalNameDataSource}
                                            // onSearch={this.handleSearch}
                                                      placeholder="请输入账户名"
                                        />
                                    )}
                                </FormItem>
                            </Col>
                        </Row>
                        <Row>
                            <Col span={7} >
                                <FormItem {...formItemLayout} label="姓名"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('aboutname', {
                                        rules: [{ required: true, message: '请输入姓名' },
                                            { pattern: /^\S+$/, message: '请不要输入空格'}],
                                    })(
                                        <Input placeholder="请输入姓名" disabled={true}/>
                                    )}
                                </FormItem>
                            </Col>
                            <Col span={7} offset={5}>
                                <FormItem {...formItemLayout} label="公司"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('company', {
                                        rules: [{ required: true, message: '请输入公司' },
                                            { pattern: /^\S+$/, message: '请不要输入空格'}],
                                    })(
                                        <Input placeholder="请输入公司" disabled={true}/>
                                    )}
                                </FormItem>
                            </Col>
                        </Row>
                        <Row>
                            <Col span={7} >
                                <FormItem {...formItemLayout} label="联系方式"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('phone', {
                                        rules: [
                                            { required: true, message: '请输入联系方式' },
                                            { pattern: /^(1[34578]\d{9})$/, message: '请输入正确的手机号' }
                                        ],
                                    })(
                                        <Input placeholder="请输入联系方式" disabled={true}/>
                                    )}
                                </FormItem>
                            </Col>
                            <Col span={7} offset={5}>
                                <FormItem {...formItemLayout} label="退费金额"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('refundmoney', {
                                        rules: [{ required: true, message: '请输入退费金额' },]

                                    })(
                                        <InputNumber  placeholder={"请输入退费金额"} disabled={true} style={{width:'100%'}} min={0} step={0.01} precision={2}/>
                                    )}
                                </FormItem>
                            </Col>
                        </Row>
                        <Row>
                            <Col span={7}>
                                <FormItem {...formItemLayout} label="申请人"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('personincharge', {
                                        rules: [{ required: true, message: '请输入申请人' },
                                            { pattern: /^\S+$/, message: '请不要输入空格'}],
                                    })(
                                        <Input placeholder="请输入申请人" disabled={true}/>
                                    )}
                                </FormItem>
                            </Col>
                            <Col span={7} offset={5} >
                                <FormItem {...formItemLayout} label="上次充值金额"  style={{ minHeight: '60px', marginBottom: 0 ,}}>
                                    {getFieldDecorator('yesterdayrecharge', {
                                    })(
                                        <InputNumber  disabled={true} style={{width:'100%'}} min={0} step={0.01} precision={2}/>
                                    )}
                                </FormItem>
                            </Col>
                            <Col span={4} className="clearfix">
                                <span  style={{ fontSize:'14px',float:'right' }}>{convertCurrency(isNaN(this.state.lastTImeMoney)?0:this.state.lastTImeMoney)}</span>
                            </Col>
                        </Row>
                        <Row>
                            <Col span={7} >
                                <FormItem {...formItemLayout} label="充值总额"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('rechargesum', {

                                    })(
                                       <InputNumber disabled={true} style={{width:'100%'}} min={0} step={0.01} precision={2} />
                                        )}
                                </FormItem>
                            </Col>
                            <Col span={4} className="clearfix">
                                <span  style={{ fontSize:'14px',float:'right' }}>{convertCurrency(isNaN(this.state.inputAllMoney)?0:this.state.inputAllMoney)}</span>
                            </Col>
                            <Col span={7} offset={1}>
                                <FormItem {...formItemLayout} label="消费金额"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('consumptionmoney', {

                                    })(
                                       <InputNumber disabled={true} style={{width:'100%'}} min={0} step={0.01} precision={2} />
                                        )}
                                </FormItem>
                            </Col>
                            <Col span={4} className="clearfix">
                                <span  style={{ fontSize:'14px',float:'right' }}>{convertCurrency(isNaN(this.state.allSpentMoney)?0:this.state.allSpentMoney)}</span>
                            </Col>
                        </Row>
                        <Row>
                            <Col span={7} >
                                <FormItem {...formItemLayout} label="总进线" style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('coillnsum', {

                                    })(
                                        <InputNumber  disabled={true}   style={{width:'100%'}} min={0} step={0.01} precision={2} />
                                    )}
                                </FormItem>
                            </Col>
                            <Col span={7} offset={5}>
                                <FormItem {...formItemLayout} label="平均进线成本" style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('averagelinecost', {
                                    })(
                                        <InputNumber disabled  style={{width:'100%'}} min={0} step={0.01} precision={2} />
                                        )}
                                </FormItem>
                            </Col>
                            <Col span={4} className="clearfix">
                                <span  style={{ fontSize:'14px',float:'right' }}>{convertCurrency(Math.round(isNaN(allSpentMoney/allInputLines)?0:allSpentMoney/allInputLines))}</span>
                            </Col>
                        </Row>
                        <Row>
                            <Col span={7} >
                                <FormItem {...formItemLayout} label="总推线"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('coiloutsum', {
                                    })(
                                        <InputNumber  disabled={true} style={{width:'100%'}} min={0} step={0.01} precision={2} />
                                    )}
                                </FormItem>
                            </Col>
                            <Col span={7} offset={5}>
                                <FormItem {...formItemLayout} label="总沟通数"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('communication', {

                                    })(
                                        <InputNumber  disabled={true} style={{width:'100%'}} min={0} step={0.01} precision={2} />
                                        )}
                                </FormItem>
                            </Col>
                        </Row>
                        <Row>
                            <Col span={7} >
                                <FormItem {...formItemLayout} label="总成单数"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('ordersum', {

                                    })(
                                        <InputNumber  disabled={true} style={{width:'100%'}} min={0} step={0.01} precision={2} />

                                        )}
                                </FormItem>
                            </Col>
                            <Col span={7} offset={5}>
                                <FormItem {...formItemLayout} label="平台出单率"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('issueratio', {
                                    })(
                                        <InputNumber    disabled={true} style={{width:'100%'}} min={0} step={0.01} max={100} precision={2} />
                                        )}
                                </FormItem>
                            </Col>
                            <Col span={4}>
                                <span style={{ fontSize:'16px' }}>%</span>
                            </Col>
                        </Row>
                        <Row>
                            <Col span={7} >
                                <FormItem {...formItemLayout} label="总成单金额"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('ordersummoney', {
                                    })(
                                       <InputNumber  disabled={true}    style={{width:'100%'}} min={0} step={0.01} precision={2} />
                                        )}
                                </FormItem>
                            </Col>
                            <Col span={4} className="clearfix">
                                <span  style={{ fontSize:'14px',float:'right' }}>{convertCurrency(isNaN(this.state.allCharge)?0:this.state.allCharge)}</span>
                            </Col>

                            <Col span={7} offset={1}>
                                <FormItem {...formItemLayout} label="产出比值"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('outputratio', {
                                    })(
                                        <Input   disabled/>
                                    )}
                                </FormItem>
                            </Col>
                        </Row>
                        <Row>
                            <Col span={7} >
                                <FormItem {...formItemLayout} label="总产值"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('totalvalueofoutput', {
                                    })(
                                        <InputNumber  disabled={true}   style={{width:'100%'}} min={0} step={0.01} precision={2} />
                                        )}
                                </FormItem>
                            </Col>
                            <Col span={4} className="clearfix">
                                <span  style={{ fontSize:'14px',float:'right' }}>{convertCurrency(isNaN(this.state.allOutput)?0:this.state.allOutput)}</span>
                            </Col>
                            <Col span={7} offset={1}>
                                <FormItem {...formItemLayout} label="其中复购总值"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('recyclesum', {

                                    })(
                                        <InputNumber  disabled={true}  style={{width:'100%'}} min={0} step={0.01} precision={2} />
                                        )}
                                </FormItem>
                            </Col>
                            <Col span={4} className="clearfix">
                                <span  style={{ fontSize:'14px',float:'right' }}>{convertCurrency(isNaN(this.state.againBoughtMoney)?0:this.state.againBoughtMoney)}</span>
                            </Col>
                        </Row>
                        <Row>
                            <Col span={7} >
                                <FormItem {...formItemLayout} label="余额"  style={{ minHeight: '60px', marginBottom: 0 }}>
                                    {getFieldDecorator('balance', {

                                    })(
                                       <InputNumber  disabled={true}    style={{width:'100%'}} min={0} step={0.01} precision={2} />
                                        )}
                                </FormItem>
                            </Col>
                            <Col span={4} className="clearfix">
                                <span  style={{ fontSize:'14px',float:'right' }}>{convertCurrency(isNaN(this.state.moneyLeft)?0:this.state.moneyLeft)}</span>
                            </Col>
                        </Row>
                       <Row>
                            <Col span={22} offset={1} >
                                <span style={{color: 'rgba(0, 0, 0, 0.85)',fontSize:'14px'}}>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;凭据照片：</span>
                                {
                                    record.refundimg?(JSON.parse(record.refundimg)).length ? (JSON.parse(record.refundimg)).map((item,i)=>{
                                        return <a href={config.Filepath + item} target="_blank" key={i} style={{marginRight:'20px'}}>
                                            <img src={config.Filepath +item} style={{ height: "100px", width: "160px" ,verticalAlign:'top'}} />
                                        </a>
                                    }):<span style={{color:'red'}}>未上传凭据照片</span>:<span style={{color:'red'}}>未上传凭据照片</span>
                                }
                            </Col>
                        </Row>
                         <Row>
                            <Col span={10} offset={2}>
                                <p>录入时间：{record.createtime}</p>
                            </Col>
                            <Col span={10} offset={2}>
                                <p>上次更新时间：{record.updatetime}</p>
                            </Col>
                        </Row>
                    </Form>
                    {(root||authTreeOfOne['/channel/refundupdate'])?record.refundimg?<div style={{textAlign:'center'}}>
                        <Button onClick={this.handleCancel.bind(this)}>驳回</Button>
                        <Button style={{marginLeft:'10px'}}  type="primary" onClick={this.saveBanner.bind(this)}>通过</Button>
                    </div>:'':''}
                </Modal>
            </div>
        )
    }
}
const ChannelListBeforeApprove = Form.create()(ChannelListBeforeApprove1);
export default ChannelListBeforeApprove;